/**
 * Dice
 * 
 * 26/10/2013
 * 
 * Copyright GPL
 */
package com.jtmproject.struts.tulebox;

import com.jtmproject.struts.tulebox.classes.Throw;
import com.opensymphony.xwork2.ActionSupport;

/**
 * This class is an action to return the result of the throw
 * @author Javier Tejedor
 */
public class Dice extends ActionSupport {
	
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -5852814609182987386L;
	
	private int numberOfSides;
	private int result;
	private String throwDice;

	/**
	 * this method do the work and return a result
	 */
	@Override
	public String execute(){
		
		result = new Throw().resultThrow(numberOfSides);
		
		return SUCCESS;
	}

	/**
	 * this returns the number of the sides
	 * @return
	 */
	public int getNumberOfSides() {
		return numberOfSides;
	}

	/**
	 * this sets the number of the sides
	 * @param numberOfSides
	 */
	public void setNumberOfSides(int numberOfSides) {
		this.numberOfSides = numberOfSides;
	}

	/**
	 * returns the result
	 * @return
	 */
	public int getResult() {
		return result;
	}
	
	/**
	 * this returns the word translate "throwDice"
	 * @return
	 */
	public String getThrowDice() {
		return throwDice;
	}

	/**
	 * this sets the word translate "throwDice"
	 * @return
	 */
	public void setThrowDice(String throwDice) {
		this.throwDice = throwDice;
	}

	/**
	 * this method is called the first time that the user call Dice.jsp
	 */
    @Override
    public String input() throws Exception{
    	return super.input();
    }
    
}
